package com.example.mapper;

import com.example.pojo.Comments;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentsMapper {
    @Select("<script>" +
            "SELECT * FROM comments " +
            "<where>" +
            "   <if test='goodsId != null'>AND goods_id = #{goodsId}</if>" +
            "   <if test='stuId != null'>AND stu_id = #{stuId}</if>" +
            "</where>" +
            "ORDER BY created_time DESC" +
            "</script>")
    List<Comments> list(Integer goodsId, Integer stuId);
}